package com.pro.service.impl;

import com.pro.entry.JsMicrocircle;
import com.pro.mapper.JsMicrocircleMapper;
import com.pro.service.JsMicrocircleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName:JsMicrocircleServiceImple
 * Package:com.pro.service.impl
 * Description:
 *
 * @Date:2022/4/8 11:23
 * @Author: ZPT
 */
@Service
public class JsMicrocircleServiceImple implements JsMicrocircleService {

    @Autowired(required = false)
    private JsMicrocircleMapper microcircleMapper;

    /**
     * @author ZPT
     * @content :查询微圈信息
     */
    @Override
    public List<JsMicrocircle> getMicrocircle(Integer acticleCategroyId) {
        List<JsMicrocircle> microcircleList = microcircleMapper.getMicrocircle(acticleCategroyId);
        //设置微圈封面地址
        for (JsMicrocircle microcircle : microcircleList) {
            microcircle.setArtcleUrl("http://" + microcircle.getArtcleUrl());
        }
        return microcircleList;
    }

    /**
     * @author ZPT
     * @content :根据id查询微圈信息
     */
    @Override
    public JsMicrocircle getMicrocircleById(Integer microcircleId) {
            JsMicrocircle microcircle = microcircleMapper.getMicrocircleById(microcircleId);
        // 设置微圈封面地址
        microcircle.setArtcleUrl("http://" + microcircle.getArtcleUrl());
        // 设置用户头像地址
        microcircle.setAvatarUrl("http://" + microcircle.getAvatarUrl());
        return microcircle;
    }
}
